from dvadmin.utils.serializers import CustomModelSerializer
from rest_framework import serializers
from .models import ProductionPlan

class ProductionPlanSerializer(CustomModelSerializer):
    """
    生产计划-序列化器
    """
    status_label = serializers.CharField(source='get_status_display', read_only=True)

    class Meta:
        model = ProductionPlan
        fields = "__all__"
        read_only_fields = ["id", "create_datetime", "update_datetime", "creator", "modifier"]

class ProductionPlanCreateUpdateSerializer(CustomModelSerializer):
    """
    生产计划-创建/更新序列化器
    """
    class Meta:
        model = ProductionPlan
        fields = '__all__'
        read_only_fields = ["id", "create_datetime", "update_datetime", "creator", "modifier"]